<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 14. BSP toolkit</a>
</td><td width="60%">
<p align="center">
=====================================<br />
14.1 Creating a BSP tree<br />
=====================================<br />
</p></td><td width="20%">
<a href="bsp_split.html">&gt; 14.2 Splitting a BSP tree</a>
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
First, you have to create the root node of the tree. This node encompasses the whole rectangular region.<br />
<p class="code"><pre>
C++ : TCODBsp::TCODBsp(int x,int y,int w, int h)
C   : TCOD_bsp_t *TCOD_bsp_new_with_size(int x,int y,int w, int h)
Py  : bsp_new_with_size(x,y,w, h)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>x,y,w,h</td><td>Top left corner position and size of the rectangular region covered by the BSP tree.</td></tr>
</table>
<br />
Example :<br />
<p class="code"><pre>
C++ : TCODBsp *myBSP = new TCODBsp(0,0,50,50);
C   : TCOD_bsp_t *my_bsp=TCOD_bsp_new_with_size(0,0,50,50);
Py  : my_bsp=libtcod.bsp_new_with_size(0,0,50,50)
</pre></p>
